<%@ Page Language="VB" AutoEventWireup="true" CodeFile="install.aspx.vb" Inherits="install_install" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Web site Installation and Set up</title>
    <style type="text/css">
    html{
    }
    
    body{
        font-family: Verdana, Tahoma, Arial;
        font-size: 0.7em;
        line-height: 1.5em;
    }
    
    .MainContent{
        padding: 10px;
        margin: 10px auto;
        width: 700px;
        border: 1px solid #CCCCCC;
    }
    
    .stepheader{
        font-weight: bold;
        text-align: center;
        width: 100%;
    }
    
    #UpdateProgress1
    {
	    position: absolute;
	    top: 20%;
	    left: 50%;
	    background-color: #ffffff;
	    height: 50px;
	    width: 250px;
	    text-align: center;
	    padding-top: 20px;
	    margin: -38px 0 0 -128px;
	    border-right: #33cc33 3px solid;
	    border-top: #33cc33 3px solid;
	    border-left: #33cc33 3px solid;
	    border-bottom: #33cc33 3px solid;
    }
</style>

    <script type="text/javascript" language="javascript">
    
    function ToggleDiv(){
        
        var div = document.getElementById("wizInstall_pnlSqlMode");
        var chk = document.getElementById("wizInstall_chkTrustedConnection");
        
        if (chk.checked){
            div.style.display = "none";
        }else{
            div.style.display = "";
        }
    }
    
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div class="MainContent">
                    <strong>Web Site Setup and Installation Wizard</strong><br />
                    <br />
                    <asp:Wizard ID="wizInstall" runat="server" DisplaySideBar="False" Width="100%" ActiveStepIndex="0"
                        OnActiveStepChanged="wizInstall_ActiveStepChanged" OnFinishButtonClick="wizInstall_FinishButtonClick"
                        OnNextButtonClick="wizInstall_NextButtonClick" OnPreviousButtonClick="wizInstall_PreviousButtonClick">
                        <WizardSteps>
                            <asp:WizardStep runat="server" Title="Welcome">
                                <div class="stepheader">
                                    Welcome</div>
                                <p>
                                    This is the Web site setup and configuration page.&nbsp; This wizard will help you
                                    set up your database and Admin user for the web site.</p>
                                <p>
                                    Before you begin, you need to grant the ASPNET or the NETWORK SERVICE accounts "<strong>Modify</strong>"
                                    and "<strong>Write</strong>" access to the Web.config file located at <asp:Label ID="webConfigLocation" runat="server" ForeColor="cornflowerblue" Font-Bold="true"></asp:Label>
                                </p>
                                <p>
                                    Why do you need to do grant these permissions? The installer will write the database
                                    connection string information to the Web.config.
                                </p>
                                <p>
                                    Click the <strong>Next</strong> button to setup your database credentials.</p>
                            </asp:WizardStep>
                            <asp:WizardStep runat="server" Title="Database Credentials">
                                <div class="stepheader">
                                    Set Database Credentials - Step 1 of 5</div>
                                <br />
                                This page allows you to choose which database you want to use, SQL Server (for networks)
                                or SQL Server Express (local).<br />
                                <br />
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td style="width: 120px">
                                            Database Server:</td>
                                        <td>
                                            <asp:TextBox ID="txtServerName" runat="server">localhost\SQLExpress</asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:CheckBox ID="chkTrustedConnection" runat="server" onclick="ToggleDiv();" Checked="True"
                                                Text="Trusted Connection" />&nbsp;- Uncheck this if you already have a username
                                            and password created for the database.
                                        </td>
                                    </tr>
                                </table>
                                <br />
                                <div id="pnlSqlMode" runat="server" style="width: 100%; display: none;">
                                    Please note: This wizard will give you the opportunity to either select the database
                                    from the a list or create a new database. If you choose to create a new database,
                                    the account provided here must have <strong>dbCreator</strong> rights on the SQL
                                    Server. If your account does not have these rights, you will have to create the
                                    database first and then select from the list provided in the next step.<br />
                                    <br />
                                    Please note: this username and password are the credentials already created on this
                                    server.&nbsp; This application will not create them.<br />
                                    <br />
                                    <table border="0" cellpadding="2" cellspacing="0">
                                        <tr>
                                            <td style="width: 100px">
                                                Username:</td>
                                            <td>
                                                <asp:TextBox ID="txtDBUsername" runat="server"></asp:TextBox>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 100px">
                                                Password:</td>
                                            <td>
                                                <asp:TextBox ID="txtDBPassword" runat="server" TextMode="Password"></asp:TextBox>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </asp:WizardStep>
                            <asp:WizardStep runat="server" Title="Setup Database">
                                <div class="stepheader">
                                    Setup the Database - Step 2 of 5</div>
                                <br />
                                This step will setup all the necessary database objects necessary to run the application,
                                including the ASP.NET Membership objects.<br />
                                <br />
                                <table>
                                <tr>
                                    <td colspan="2"><b>Select existing database</b></td>
                                </tr>
                                <tr>
                                    <td>Databases:</td>
                                    <td><asp:DropDownList ID="ddlDbList" runat="server">
                                </asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td colspan="2">- or -</td>
                                </tr>
                                <tr>
                                    <td colspan="2"><b>Create database</b></td>
                                </tr>
                                <tr>
                                    <td>Database Name:</td>
                                    <td><asp:TextBox ID="txtDBName" runat="server"></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td></td>
                                </tr>
                                </table>                                
                            </asp:WizardStep>
                            <asp:WizardStep runat="server" Title="Create Admin Account">
                                <div class="stepheader">
                                    Create the Admin Account - Step 3 of 5</div>
                                <br />
                                Enter the credentials for the Web Site administrator account.&nbsp; You will use
                                these credentials to log into the Web Site application and administer the site which
                                includes managing other user accounts.<br />
                                <br />
                                <table border="0" cellpadding="2" cellspacing="0">
                                    <tr>
                                        <td>
                                            Admin Username:</td>
                                        <td>
                                            <asp:TextBox ID="txtAdminUserName" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valAdminUsername" runat="server" ControlToValidate="txtAdminUserName"
                                                ErrorMessage="Required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Password:</td>
                                        <td>
                                            <asp:TextBox ID="txtAdminPassword" runat="server" TextMode="Password"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valAdminPassword" runat="server" ControlToValidate="txtAdminPassword"
                                                Display="Dynamic" ErrorMessage="Required"></asp:RequiredFieldValidator>
                                            &nbsp;&nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Password Confirm:</td>
                                        <td>
                                            <asp:TextBox ID="txtAdminPasswordConfirm" runat="server" TextMode="Password"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valAdminPasswordConfirm" runat="server" ControlToValidate="txtAdminPasswordConfirm"
                                                Display="Dynamic" ErrorMessage="Required"></asp:RequiredFieldValidator>
                                            <asp:CompareValidator ID="compareAdminPasswords" runat="server" ControlToCompare="txtAdminPassword"
                                                ControlToValidate="txtAdminPasswordConfirm" Display="Dynamic" ErrorMessage="Passwords don't match"></asp:CompareValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <hr size="1" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Email:</td>
                                        <td>
                                            <asp:TextBox ID="txtAdminEmail" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valAdminEmail" runat="server" ControlToValidate="txtAdminEmail"
                                                ErrorMessage="Required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Email Confirm:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtAdminEmailConfirm" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valAdminEmailConfirm" runat="server" ControlToValidate="txtAdminEmailConfirm"
                                                Display="Dynamic" ErrorMessage="Required"></asp:RequiredFieldValidator>
                                            <asp:CompareValidator ID="compareEmail" runat="server" ControlToCompare="txtAdminEmail"
                                                ControlToValidate="txtAdminEmailConfirm" ErrorMessage="Email addresses don't match"></asp:CompareValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Secret Question:</td>
                                        <td>
                                            <asp:TextBox ID="txtSecretQuestion" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valSecretQuestion" runat="server" ControlToValidate="txtSecretQuestion"
                                                ErrorMessage="Required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Secret Answer:</td>
                                        <td>
                                            <asp:TextBox ID="txtSecretAnswer" runat="server"></asp:TextBox>
                                        </td>
                                        <td>
                                            <asp:RequiredFieldValidator ID="valSecretAnswer" runat="server" ControlToValidate="txtSecretAnswer"
                                                ErrorMessage="Required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                </table>
                            </asp:WizardStep>
                            <asp:WizardStep runat="server" Title="Confirmation" StepType="Finish">
                                <div class="stepheader">
                                    Confirmation - Step 4 of 5</div>
                                <br />
                                When you confirm these settings, you can click the Finish button to start the process
                                of creating the application.<br />
                                <br />
                                <table border="0" cellpadding="3" cellspacing="0">
                                    <tr>
                                        <td>
                                            Server:</td>
                                        <td>
                                            <asp:Label ID="lblServerName" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Database:</td>
                                        <td>
                                            <asp:Label ID="lblDatabaseName" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="rowDbUsername" runat="server">
                                        <td>
                                            DB Username:
                                        </td>
                                        <td>
                                            <asp:Label ID="lblDBUserName" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr id="rowDbPassword" runat="server">
                                        <td>
                                            DB Password:</td>
                                        <td>
                                            <asp:Label ID="lblDBPassword" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <hr size="1" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Admin Username:
                                        </td>
                                        <td>
                                            <asp:Label ID="lblAdminUsername" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Admin Password:</td>
                                        <td>
                                            <asp:Label ID="lblAdminPassword" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Admin Email:</td>
                                        <td>
                                            <asp:Label ID="lblAdminEmail" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Admin Secret Question:
                                        </td>
                                        <td>
                                            <asp:Label ID="lblAdminSecretQuestion" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Admin Secret Answer:</td>
                                        <td>
                                            <asp:Label ID="lblAdminSecretAnswer" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                                <br />
                                Click the Finish button to setup the database.</asp:WizardStep>
                            <asp:WizardStep runat="server" Title="Completed" StepType="Complete">
                                <div class="stepheader">
                                    Completed - Step 5 of 5</div>
                                <p>
                                    Your web site has been successfully setup!</p>
                                <p>
                                    Now that your web site has been setup, be sure to delete this Install folder if
                                    your site is live!</p>
                                <p>
                                    <asp:HyperLink ID="lblFinish" runat="server" NavigateUrl="~/Default.aspx">Click here</asp:HyperLink>
                                    &nbsp;to Log on.</p>
                            </asp:WizardStep>
                        </WizardSteps>
                    </asp:Wizard>
                    <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <img src="../images/spinner.gif" />
                Processing... please wait!
            </ProgressTemplate>
        </asp:UpdateProgress>
    </form>
</body>
</html>
